package com.jinyang.baserouter

import android.app.Application
import android.content.Context
import androidx.startup.Initializer
import com.alibaba.android.arouter.launcher.ARouter

/**
 * @Author: LiuJinYang
 * @CreateDate: 2021/12/10
 * @Description:
 */
class BaseRouterInitializer : Initializer<Unit> {
    //在create方法中执行要初始化的代码
    override fun create(context: Context) {
        log("BaseRouterInitializer.create")
        val application = context.applicationContext as Application?
        application?.let {
            if (BuildConfig.DEBUG) {
                ARouter.openLog()
                ARouter.openDebug()
            }
            ARouter.init(application)
        }
    }

    //dependencies方法用于配置当前LjyToastInitializer是否还依赖于其他Initializer
    //有的话在此配置，没有就return emptyList()即可
    override fun dependencies(): List<Class<out Initializer<*>>> {
        return emptyList()
    }
}
